import {request} from '@/utils/request';
import type {BaseResponse} from '@/utils/request';

/**
 * 获取项目分页数据
 * @param query
 */
export function getProjectPage(data: API.projectPage) {
  return request<BaseResponse<API.Project[]>>(
    {
      url: '/p_project/list',
      method: 'post',
      data: data,
    }
  )
}

/**
 * 保存项目信息
 * @param data
 */
export function save(data: API.saveProject) {
  return request({
    url: '/p_project/save',
    method: 'post',
    data: data
  })
}

/**
 * 删除项目
 */
export function deleteProjectById(id: number) {
  return request({
    url: '/p_project/delete',
    params: {id: id}
  })
}

/**
 * 部门人员树
 */
export function departUserTree(tenantId: string) {
  return request({
    url: '/ww_depart/departUserTree',
    method: 'get',
    params: {tenantId: tenantId}
  })
}

/**
 * 修改项目人员
 */
export function editUser(data: API.ProjectUserSaveBO) {
  return request({
    url: '/p_project/editUser',
    method: 'post',
    data: data
  })
}
